package org.akomantoso.core.data;

import java.io.IOException;

import org.akomantoso.core.data.group.PrefaceContainers;
import org.akomantoso.core.io.Output;
import org.akomantoso.core.visitor.AKVisitor;

/**
 * The element formula is a section of the preface or preamble that contains a formulaic expression that is
 * systematically or frequently present in a preface or a preamble and has e precise legal meaning (e.g. an enacting
 * formula). Use the refersTo attribute for the specification of the actual type of formula..
 * 
 * <pre>
 * 	<xsd:element name="formula" type="blocksopt"/>
 * </pre>
 * 
 * @author <a href="mailto:jacques.militello@gmail.com">Jacques Militello</a>
 * 
 * @since http://www.akomantoso.org/1.0
 * 
 */
public final class Formula extends Blocksopt implements PrefaceContainers {

	public static final String ELEMENT = "formula";

	/**
	 * @see org.akomantoso.core.data.Blocksopt#writeExternal(org.akomantoso.core.io.Output)
	 */
	@Override
	public <T extends Output> void writeExternal(T out) throws IOException {
		out.writeStart(ELEMENT);
		super.writeExternal(out);
		out.writeEnd();
	}

	/**
	 * @see org.akomantoso.core.visitor.AKVisitable#accept(org.akomantoso.core.visitor.AKVisitor)
	 */
	@Override
	public void accept(AKVisitor visitor) {
		if (visitor.visitBegin(this)) {
			internalAccept(visitor);
			visitor.visitEnd(this);
		}
	}

}